﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;
using ClientModel;

namespace Client
{
    /// <summary>
    /// Interaction logic for pagSearch.xaml
    /// </summary>
    public partial class pagSearch : Page
    {
        private static pagSearch me;

        private pagSearch()
        {
            InitializeComponent();
        }

        public static pagSearch getInstance()
        {
            if (me == null)
                me = new pagSearch();
            return me;
        }

        private void txb_GotFocus(object sender, RoutedEventArgs e)
        {
            keyb.ControlToWriteToo = (TextBox)sender;
        }

        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            grdContent.Opacity = .5;
            this.IsEnabled = false;
            this.Focusable = false;
            winSearchResults res = new winSearchResults(txbName.Text, txbCPR.Text, txbAdress.Text, txbZip.Text, txbHangerNo.Text, this);
            res.Show();
        }

        public void cleanupAfterResults()
        {
            grdContent.Opacity = 1;
            this.IsEnabled = true;
            this.Focusable = true;
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            MainWindow.SetPage(pagSession.getInstance());
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}